package com.liang.paul.officelite.activities;

import android.content.Intent;
import android.os.Bundle;

import com.liang.paul.officelite.R;
import com.liang.paul.officelite.beams.OfficeUser;

import cn.bmob.v3.Bmob;
import cn.bmob.v3.BmobUser;

public class WelcomeActivity extends FastActivity {

    BmobUser currentUser;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        Bmob.initialize(this, "50b96d226e040c029fb83df752b7a77d");
        currentUser = BmobUser.getCurrentUser(this, OfficeUser.class);
        if(currentUser == null){
            finish();
            startActivity(new Intent(WelcomeActivity.this, LoginActivity.class));
        }else{
            if (!currentUser.getEmailVerified()){
                finish();
                startActivity(new Intent(WelcomeActivity.this, LoginActivity.class));
            }else {
                finish();
                startActivity(new Intent(WelcomeActivity.this, TeamActivity.class));
            }
        }
    }
}
